<template>
  <div class="shareIcon" @click="copy">
    <div class="copyIcon" title="复制链接" >
      <img src="../assets/imgs/copy.png" alt="" />
    </div>
    <div class="btn-number">复制链接</div>
  </div>
</template>

<script>
export default {
  props: {
    artId: {
      type: Number,
    },
  },
  data() {
    return {
      message: "测试",
    };
  },
  watch: {
    artId: {
      handler(newVal, oldVal) {
        this.id = newVal;
      },
      immediate: true,
    },
  },
  methods: {
    copy() {
      let url = `https://www.laismell.com/#/artDetail`;
      // let url = `http://localhost:8084/#/artDetail`;
      this.$copyText(`${url}?id=${this.id}`).then(
        (res) => {
          this.$message({
            message: "复制成功",
            type: "success",
          });
          console.log("成功");
        },
        (err) => {}
      );
    },
  },
};
</script>
<style lang="scss" scoped>
/* 分享图标样式 */
.shareIcon {
  display: flex;
  margin-left: -0.2rem;
  align-items: center;
  .copyIcon {
    width: 0.22rem;
    height: 0.22rem;
    opacity: 1;
    cursor: pointer;
    border-radius: 1rem;
  }
  img {
    width: 100%;
    height: 100%;
    display: block;
  }
}
.shareIpt {
  display: none;
}
.btn-number {
  font-size: 0.14rem;
  font-family: PingFang SC;
  font-weight: 400;
  color: rgba(153, 153, 153, 1);
  opacity: 1;
  margin-left: 0.08rem;
}
</style>
